home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / SoundInput.a < prev    next >
Encoding:
Text File  |  1994-11-11  |  7.3 KB  |  350 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        SoundInput.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__SOUNDINPUT__') = 'UNDEFINED' THEN
  18. __SOUNDINPUT__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24. ;        include 'ConditionalMacros.a'                                ;
  25.  
  26.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  27.     include 'Dialogs.a'
  28.     ENDIF
  29. ;        include 'Errors.a'                                            ;
  30. ;        include 'Memory.a'                                            ;
  31. ;            include 'MixedMode.a'                                    ;
  32. ;        include 'Windows.a'                                        ;
  33. ;            include 'Quickdraw.a'                                    ;
  34. ;                include 'QuickdrawText.a'                            ;
  35. ;            include 'Events.a'                                        ;
  36. ;                include 'OSUtils.a'                                ;
  37. ;            include 'Controls.a'                                    ;
  38. ;                include 'Menus.a'                                    ;
  39. ;        include 'TextEdit.a'                                        ;
  40.  
  41.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  42.     include 'Files.a'
  43.     ENDIF
  44.  
  45.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  46.     include 'Sound.a'
  47.     ENDIF
  48.  
  49. siDeviceIsConnected                EQU        1                    ;input device is connected and ready for input
  50. siDeviceNotConnected            EQU        0                    ;input device is not connected
  51. siDontKnowIfConnected            EQU        -1                    ;can't tell if input device is connected
  52. siReadPermission                EQU        0                    ;permission passed to SPBOpenDevice
  53. siWritePermission                EQU        1                    ;permission passed to SPBOpenDevice
  54.  
  55. ;Info Selectors for Sound Input Drivers
  56. siDeviceConnected                EQU        'dcon'                ;input device connection status
  57. siAGCOnOff                        EQU        'agc '                ;automatic gain control state
  58. siPlayThruOnOff                    EQU        'plth'                ;playthrough state
  59. siTwosComplementOnOff            EQU        'twos'                ;two's complement state
  60. siLevelMeterOnOff                EQU        'lmet'                ;level meter state
  61. siRecordingQuality                EQU        'qual'                ;recording quality
  62. siVoxRecordInfo                    EQU        'voxr'                ;VOX record parameters
  63. siVoxStopInfo                    EQU        'voxs'                ;VOX stop parameters
  64. siNumberChannels                EQU        'chan'                ;current number of channels
  65. siSampleSize                    EQU        'ssiz'                ;current sample size
  66. siSampleRate                    EQU        'srat'                ;current sample rate
  67. siCompressionType                EQU        'comp'                ;current compression type
  68. siCompressionFactor                EQU        'cmfa'                ;current compression factor
  69. siCompressionHeader                EQU        'cmhd'                ;return compression header
  70. siDeviceName                    EQU        'name'                ;input device name
  71. siDeviceIcon                    EQU        'icon'                ;input device icon
  72. siDeviceBufferInfo                EQU        'dbin'                ;size of interrupt buffer
  73. siSampleSizeAvailable            EQU        'ssav'                ;sample sizes available
  74. siSampleRateAvailable            EQU        'srav'                ;sample rates available
  75. siCompressionAvailable            EQU        'cmav'                ;compression types available
  76. siChannelAvailable                EQU        'chav'                ;number of channels available
  77. siAsync                            EQU        'asyn'                ;asynchronous capability
  78. siOptionsDialog                    EQU        'optd'                ;display options dialog
  79. siContinuous                    EQU        'cont'                ;continous recording
  80. siActiveChannels                EQU        'chac'                ;active channels
  81. siActiveLevels                    EQU        'lmac'                ;active meter levels
  82. siInputSource                    EQU        'sour'                ;input source selector
  83. siInputSourceNames                EQU        'snam'                ;input source names
  84. siInputGain                        EQU        'gain'                ;input gain
  85. siInitializeDriver                EQU        'init'                ;reserved for internal use only
  86. siCloseDriver                    EQU        'clos'                ;reserved for internal use only
  87. siPauseRecording                EQU        'paus'                ;reserved for internal use only
  88. siUserInterruptProc                EQU        'user'                ;reserved for internal use only
  89. ;Qualities
  90. siBestQuality                    EQU        'best'
  91. siBetterQuality                    EQU        'betr'
  92. siGoodQuality                    EQU        'good'
  93.  
  94. ;user procedures called by sound input routines
  95. SPB                     RECORD    0
  96. inRefNum                 ds.l    1                                    ;reference number of sound input device
  97. count                     ds.l    1                                    ;number of bytes to record
  98. milliseconds             ds.l    1                                    ;number of milliseconds to record
  99. bufferLength             ds.l    1                                    ;length of buffer in bytes
  100. bufferPtr                 ds.l    1                                    ;buffer to store sound data in
  101. completionRoutine         ds.l    1                                    ;completion routine
  102. interruptRoutine         ds.l    1                                    ;interrupt routine
  103. userLong                 ds.l    1                                    ;user-defined field
  104. error                     ds.w    1                                    ;error
  105. unused1                     ds.l    1                                    ;reserved - must be zero
  106. sizeof                     EQU    38
  107.                         ENDR
  108.  
  109.     IF GENERATING68K THEN
  110.         Macro
  111.         _SPBVersion
  112.             dc.w     $203C
  113.             dc.w     $0000
  114.             dc.w     $0014
  115.             dc.w     $A800
  116.         EndM
  117.     ELSE
  118.         IMPORT    SPBVersion
  119.     ENDIF
  120.  
  121.     IF GENERATING68K THEN
  122.         Macro
  123.         _SndRecord
  124.             dc.w     $203C
  125.             dc.w     $0804
  126.             dc.w     $0014
  127.             dc.w     $A800
  128.         EndM
  129.     ELSE
  130.         IMPORT    SndRecord
  131.     ENDIF
  132.  
  133.     IF GENERATING68K THEN
  134.         Macro
  135.         _SndRecordToFile
  136.             dc.w     $203C
  137.             dc.w     $0708
  138.             dc.w     $0014
  139.             dc.w     $A800
  140.         EndM
  141.     ELSE
  142.         IMPORT    SndRecordToFile
  143.     ENDIF
  144.  
  145.     IF GENERATING68K THEN
  146.         Macro
  147.         _SPBSignInDevice
  148.             dc.w     $203C
  149.             dc.w     $030C
  150.             dc.w     $0014
  151.             dc.w     $A800
  152.         EndM
  153.     ELSE
  154.         IMPORT    SPBSignInDevice
  155.     ENDIF
  156.  
  157.     IF GENERATING68K THEN
  158.         Macro
  159.         _SPBSignOutDevice
  160.             dc.w     $203C
  161.             dc.w     $0110
  162.             dc.w     $0014
  163.             dc.w     $A800
  164.         EndM
  165.     ELSE
  166.         IMPORT    SPBSignOutDevice
  167.     ENDIF
  168.  
  169.     IF GENERATING68K THEN
  170.         Macro
  171.         _SPBGetIndexedDevice
  172.             dc.w     $203C
  173.             dc.w     $0514
  174.             dc.w     $0014
  175.             dc.w     $A800
  176.         EndM
  177.     ELSE
  178.         IMPORT    SPBGetIndexedDevice
  179.     ENDIF
  180.  
  181.     IF GENERATING68K THEN
  182.         Macro
  183.         _SPBOpenDevice
  184.             dc.w     $203C
  185.             dc.w     $0518
  186.             dc.w     $0014
  187.             dc.w     $A800
  188.         EndM
  189.     ELSE
  190.         IMPORT    SPBOpenDevice
  191.     ENDIF
  192.  
  193.     IF GENERATING68K THEN
  194.         Macro
  195.         _SPBCloseDevice
  196.             dc.w     $203C
  197.             dc.w     $021C
  198.             dc.w     $0014
  199.             dc.w     $A800
  200.         EndM
  201.     ELSE
  202.         IMPORT    SPBCloseDevice
  203.     ENDIF
  204.  
  205.     IF GENERATING68K THEN
  206.         Macro
  207.         _SPBRecord
  208.             dc.w     $203C
  209.             dc.w     $0320
  210.             dc.w     $0014
  211.             dc.w     $A800
  212.         EndM
  213.     ELSE
  214.         IMPORT    SPBRecord
  215.     ENDIF
  216.  
  217.     IF GENERATING68K THEN
  218.         Macro
  219.         _SPBRecordToFile
  220.             dc.w     $203C
  221.             dc.w     $0424
  222.             dc.w     $0014
  223.             dc.w     $A800
  224.         EndM
  225.     ELSE
  226.         IMPORT    SPBRecordToFile
  227.     ENDIF
  228.  
  229.     IF GENERATING68K THEN
  230.         Macro
  231.         _SPBPauseRecording
  232.             dc.w     $203C
  233.             dc.w     $0228
  234.             dc.w     $0014
  235.             dc.w     $A800
  236.         EndM
  237.     ELSE
  238.         IMPORT    SPBPauseRecording
  239.     ENDIF
  240.  
  241.     IF GENERATING68K THEN
  242.         Macro
  243.         _SPBResumeRecording
  244.             dc.w     $203C
  245.             dc.w     $022C
  246.             dc.w     $0014
  247.             dc.w     $A800
  248.         EndM
  249.     ELSE
  250.         IMPORT    SPBResumeRecording
  251.     ENDIF
  252.  
  253.     IF GENERATING68K THEN
  254.         Macro
  255.         _SPBStopRecording
  256.             dc.w     $203C
  257.             dc.w     $0230
  258.             dc.w     $0014
  259.             dc.w     $A800
  260.         EndM
  261.     ELSE
  262.         IMPORT    SPBStopRecording
  263.     ENDIF
  264.  
  265.     IF GENERATING68K THEN
  266.         Macro
  267.         _SPBGetRecordingStatus
  268.             dc.w     $203C
  269.             dc.w     $0E34
  270.             dc.w     $0014
  271.             dc.w     $A800
  272.         EndM
  273.     ELSE
  274.         IMPORT    SPBGetRecordingStatus
  275.     ENDIF
  276.  
  277.     IF GENERATING68K THEN
  278.         Macro
  279.         _SPBGetDeviceInfo
  280.             dc.w     $203C
  281.             dc.w     $0638
  282.             dc.w     $0014
  283.             dc.w     $A800
  284.         EndM
  285.     ELSE
  286.         IMPORT    SPBGetDeviceInfo
  287.     ENDIF
  288.  
  289.     IF GENERATING68K THEN
  290.         Macro
  291.         _SPBSetDeviceInfo
  292.             dc.w     $203C
  293.             dc.w     $063C
  294.             dc.w     $0014
  295.             dc.w     $A800
  296.         EndM
  297.     ELSE
  298.         IMPORT    SPBSetDeviceInfo
  299.     ENDIF
  300.  
  301.     IF GENERATING68K THEN
  302.         Macro
  303.         _SPBMillisecondsToBytes
  304.             dc.w     $203C
  305.             dc.w     $0440
  306.             dc.w     $0014
  307.             dc.w     $A800
  308.         EndM
  309.     ELSE
  310.         IMPORT    SPBMillisecondsToBytes
  311.     ENDIF
  312.  
  313.     IF GENERATING68K THEN
  314.         Macro
  315.         _SPBBytesToMilliseconds
  316.             dc.w     $203C
  317.             dc.w     $0444
  318.             dc.w     $0014
  319.             dc.w     $A800
  320.         EndM
  321.     ELSE
  322.         IMPORT    SPBBytesToMilliseconds
  323.     ENDIF
  324.  
  325.     IF GENERATING68K THEN
  326.         Macro
  327.         _SetupSndHeader
  328.             dc.w     $203C
  329.             dc.w     $0D48
  330.             dc.w     $0014
  331.             dc.w     $A800
  332.         EndM
  333.     ELSE
  334.         IMPORT    SetupSndHeader
  335.     ENDIF
  336.  
  337.     IF GENERATING68K THEN
  338.         Macro
  339.         _SetupAIFFHeader
  340.             dc.w     $203C
  341.             dc.w     $0B4C
  342.             dc.w     $0014
  343.             dc.w     $A800
  344.         EndM
  345.     ELSE
  346.         IMPORT    SetupAIFFHeader
  347.     ENDIF
  348.  
  349.     ENDIF ; __SOUNDINPUT__
  350.